Skip to content

[2/6] Add the NEP-spin potential to GPUMD - #1852

Draft
aboys-cb wants to merge 5 commits into
brucefan1983:masterfrom
MagTheoryLab:codex/spin-2-potential
Draft

aboys-cb wants to merge 5 commits into
brucefan1983:masterfrom
MagTheoryLab:codex/spin-2-potential

Conversation

@aboys-cb

@aboys-cb aboys-cb commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Load current model nep_spin, spin_version 1 models in GPUMD and evaluate energy, atomic force, magnetic force and the full virial. Support fixed spins under nve/nvt_nhc, single-process multi-GPU evaluation, spin XYZ input/output, replication, fixed-spin restart, and group/region magnetic fields.

Atoms excluded by spin_type contribute their geometry with zero effective spin and zero magnetic force. The runtime reads the shared typed model representation directly and reuses the training descriptor kernels.

Scope

Part 2 of six. Part 1 (#1851) is merged; this branch now includes master b9d6f89e6658ffed4a249d5eecc9d050bf58465a. The diff against master contains this runtime extension only.

  • Keep the training implementation, ordinary NEP neighbor handling, GPU vector utilities and all integrators identical to master.
  • Keep Spin-specific neighbors, model state, field handling and input restrictions in force/nep_spin/. Expose two host launch functions for existing structural force kernels; the CUDA kernels remain internal.
  • Limit public changes to model registration, spin force dispatch and necessary atom/input/output support.
  • Use the current model format. No legacy Spin model conversion or spin-integrator checkpoint state is added.

Spin integrators and coupled relaxation remain in #1853, #1854, #1855 and #1856.

Validation

Validated on Sai with four V100 GPUs, CUDA 12.9.1, sm_70, and the Makefile's C++14 mode; C++17-extension diagnostics were promoted to errors. Baseline gpumd and nep were freshly built from master b9d6f89. Validation of 9868aaafeca6982d70444c2cfb5450e6fa911038:

  • 46 model-format and validation-helper tests passed.
  • 24 frozen FP64 runtime cases passed, including energy, atomic force, magnetic force and all nine virial components. Energy-reference invariance, excluded-spin masking, reordered model fields, replication and fixed-spin restart also passed.
  • Analytic group/region magnetic-field checks passed on one GPU.
  • Spin training native/JIT comparisons and the training lifecycle checks passed on one GPU.
  • 29 fixed-spin comparisons across 1/2/4 GPUs passed, including partition directions, small cells, triclinic and nonuniform structures, cutoff boundaries and moving atoms.
  • Full upstream regression: 254 passed, 1 failed; 25 relations passed. The failure is qnep_pppm_future_bec: one thermo.out field differs by 1.0e-6 against an absolute tolerance of 1.0e-7. It occurred in both full runs. Five isolated upstream self-comparisons and five interleaved repetitions each of upstream/upstream, upstream/candidate and candidate/candidate all passed on other allocated nodes. QNEP source and test tolerances are unchanged; the cause is not established and the full-suite failure remains open.
  • The full GPU matrix was followed only by whitespace formatting of two added host launcher functions. The exact formatted sources were rebuilt and all 24 runtime oracle cases passed again.
  • All 11 new C++/CUDA files pass repository clang-format 17.0.6 checks; strict Sphinx HTML (-W --keep-going) and the diff whitespace check passed.

Reproducible commands: fixed-spin runtime validation and training validation. Numerical tolerances and frozen oracle values are unchanged.

These checks cover implementation correctness, not scientific fit quality or performance. Windows, HIP and WPE execution are not validated here. The separately tracked ordinary-NEP large-YIG multi-GPU discrepancy is outside this PR and is not closed by these checks.

Load exported NEP-spin models and evaluate energy, atomic forces, magnetic forces and the full virial in GPUMD. Add single-process multi-GPU evaluation, per-atom spin input/output and replication, fixed-spin restart output, and group/region magnetic fields.

The spin coordinates remain fixed under ordinary supported lattice integration. No spin integrator, spin velocity, or lattice-thermostat checkpoint state is introduced. Runtime and training reuse the descriptor kernels from part 1.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant